/*
 * @Author: your name
 * @Date: 2021-10-11 13:57:55
 * @LastEditTime: 2021-12-25 14:02:27
 * @LastEditors: Please set LastEditors
 * @Description: 举报管理配置文件
 * @FilePath: \工作项目\ebc-admin\src\views\report\config\management.config.js
 */
 // 公共方法
import { asyncApiFun } from "@/utils/utils.js";
// 接口
import { reportReasonList } from "@/api/report.js";
// 列表
export const listHeader = [
    { prop: 'reportId', label: '举报编号'},
    { prop: 'reportType', label: '举报类型',isTemplate: true},
    { prop: 'reportReasonName', label: '举报原因'},
    { prop: 'businessName', label: '被举报人' },
    { prop: 'memberName', label: '举报人'},
    { prop: 'reportStatus', label: '状态', isTemplate: true },
    { prop: 'gmtCreate', label: '创建时间' },
    { prop: 'authUserName', label: '审核人'},
    { prop: 'gmtAuthTime', label: '审核时间' },
    { prop: 'operat', label: '操作', isTemplate: true }
  ]
  const type = [
    { value: '1', title: '聊天举报' },
    { value: '2', title: '群聊举报' },
    { value: '3', title: '个人动态举报' }
  ]
  const stutas = [
    { value: '0', title: '待审核' },
    { value: '1', title: '已通过' },
    { value: '2', title: '已拒绝' }
  ]
  // 举报原因
const reason = [
  { value: '0',label: '聊天(群聊)举报', children:[]},
  { value: '1',label: '动态举报', children:[]},
  { value: '2',label: '个（组织）名片举报', children:[] }
]
const props = {
  expandTrigger: 'hover',
  lazy: true,
  async lazyLoad (node, resolve) {
    // 举报类型
    let type = node.data.value;
    const list = []
    // 网络请求
    const [res] = await asyncApiFun(reportReasonList,type)
    if(res) {
      res.data.filter(item => {
        list.push({
          value:item.settingsId,
          label:item.settingsName,
          leaf:true
        })
      })
    }
    resolve(list);
  }
}
  // 搜索框
  export const searchs = [
    { type: 'input', key: 'reportId', value: '', placeholder: '举报编码' },
    { type: 'select', key: 'reportType', value: '', selectList: type, placeholder: '举报类型' },
    { type: 'cascader', key: 'reportReasonName', value: '', options: reason ,props:props, placeholder: '举报原因' },
    { type: 'select', key: 'reportStatus' ,value: '' ,selectList: stutas , placeholder: '状态'}
  ]
  // 审核框配置
  export const textLists = [
    { type: 'txt', key: 'reportType', title: '举报类型: ',isTemplate: true },
    { type: 'txt', key: 'reportId', title: '举报项编号: ' },
    { type: 'txt', key: 'reportReasonName', title: '举报原因: ' },
    { type: 'txt', key: 'reportContent', title: '举报内容: ' },
    { type: 'image-group', key: 'reportPicture', span: 24, title: '举报截图: ' }
  ]
  //审核同意框配置
  const frozen = [
    {title: '冻结', value: true},
    {title: '不冻结', value: false}
  ]
  // disabled 标记
  
  export const editList = [
    { type:'radio',key:'freeze' ,label:'',
      getLabel(type) {
         let _label='';
         switch (type) {
           case '4':
            _label='个人账户：'
            break;
           case '5':
            _label='组织：'
            break;
           default: 
           _label="账户："
         }
         return _label;
       } ,
      data:frozen ,
      change(val){
        if (!editList.duration) {
          editList.duration = editList.find(item=>item.key=='duration')
        }
        editList.duration.isforze = !val;
      },
    },
    { type:'input-checkbox',key:'duration', key1:'frozen1' ,value:'30', label:'冻结时长：', name:'永久' , isforze:true},
    
  ] 
//审核拒绝框配置 
  export const editList2 = [
    { type: 'textarea', key: 'reason', label: '拒绝原因', placeholder: '请输入' }
  ]
 export const rules = {
  reason: { required: true, message: '请输入拒绝原因' }
}  
// 审核详情数据配置
export const textLists2 = function(config){
  // 个人动态举报配置
  const dynamic = [
    { type: 'textarea', key: 'dynamicContent', title: '动态内容: ',span: 24 },
    { type: 'image-group', key: 'picture', span: 24, title: '动态图片: ' },
    
  ]
  // 产品服务
  const product = [
    { type: 'txt', key: 'productName',span: 24, title: '商品名称: ' },
    { type: 'txt', key: 'productPrice',span: 24, title: '价格: ' },
    { type: 'textarea', key: 'productDetail', span: 24,title: '详情介绍: ' },
    { type: 'image-group', key: 'productUrlList', span: 24,title: '商品图片: '}
  ]
  // 组织动态
  const organDynamics = [
    { type: 'txt', key: 'dynamicName', title: '标题: ' ,span: 24,},
    { type: 'image', key: 'thumbnail', title: '缩略图: ' ,style:'width: 30%;height:40%;margin-left:20px;',span: 24,},
    { type: 'textarea', key: 'dynamicDetail', title: '详情: ',span: 24, },
    
  ]
  if(config =='3') return dynamic
  else if (config=='7') return product
  else return organDynamics 
}

